function processLocation(location,user,topic)
{
    var fromDate = $('#datepicker_for').val();
    var toDate = $('#datepicker_to').val();
     $.get('LocationServlet',{'location':location,'fromDate': fromDate, 'toDate':toDate, 'user':user, 'topic':topic}, function(data)
        {
           var userList = $('#user-list');
           
           userList.html('');
           for(var i=0;i<data.TopUsers.length;i++)
            {
                userList.append('<li><a target="_blank" href="https://twitter.com/'+data.TopUsers[i].screen_name+'">'+
                                   '<img width="48px" src="'+data.TopUsers[i].profile_image_url
                                +'" title="'+data.TopUsers[i].user_name+'" />'+
                                  '</a> </li>');
            }
            var currentTopicIds=[];
            var topicList = $('#topic-list');
           
            topicList.html('');
            for( i=0;i<data.TopTopics.length;i++)
            {
                topicList.append('<li><a target="_blank" href="https://twitter.com/search?q=%23'+data.TopTopics[i].Topic+'">'
                                +data.TopTopics[i].Topic
                                 + '</a> </li>');
                currentTopicIds.push(data.TopTopics[i].TopicId);
            }
            if(data.TweetLocations.length > 0)
            {
                redrawMap(data.TweetLocations);
            }
            if(data.ContinentInfo.length > 0)
            {
                processPie(data.ContinentInfo);
            }
            if(currentTopicIds.length > 0)
            {
               fillUpNorthAmerica(currentTopicIds);
            }
        }
        );
}
function redrawMap(data) {
        var firstLocation = data[0];
        var mapOptions = {
          scaleControl: true,
          center: new google.maps.LatLng(firstLocation.latitude,firstLocation.longitude),
          zoom: 3,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        var map = new google.maps.Map(document.getElementById('map-canvas'),
            mapOptions);
        
        var marker,i;
        var infowindow = new google.maps.InfoWindow();
            
        for (i = 0; i < data.length; i++) {  
            marker = new google.maps.Marker({
              position: new google.maps.LatLng(data[i].latitude, data[i].longitude),
              map: map
            });

            google.maps.event.addListener(marker, 'click', (function(marker, i) {
              return function() {
                infowindow.setContent('<a target="_blank" href="https://twitter.com/'+data[i].screen_name
                                        +'/status/'
                                        +data[i].tweet_id
                                        +'">'
                                        +data[i].tweet_text+'</a>');
                infowindow.open(map, marker);
              }
            })(marker, i));
        }
}